<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<base href="<%=basePath%>">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<link href="css/style1.css" rel="stylesheet" type="text/css" />
<link href="css/select.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/jquery.idTabs.min.js"></script>
<script type="text/javascript" src="js/select-ui.min.js"></script>
<script type="text/javascript" src="editor/kindeditor.js"></script>

<script type="text/javascript">
    KE.show({
        id : 'content7',
        cssPath : './index.css'
    });
  </script>

<script type="text/javascript">
$(document).ready(function(e) {
	if($("#status").val()=="yes"){
		$("#chocked").html("已上架")
	}
	if($("#status").val()=="no"){
		$("#chocked").html("未上架")
	}
	if($("#status").val()=="all"){
		$("#chocked").html("全部")
	}
	
    $(".select1").uedSelect({
		width : 345			  
	});
	$(".select2").uedSelect({
		width : 167  
	});
	$(".select3").uedSelect({
		width : 100
	});
});

$(function(){

	$("#selected1").change(function(){
	
		var mstatus=$(this).val();
		if(mstatus=="全部"){
			window.location="/admin_music_info?mstatus=all";
		}else if(mstatus=="已上架"){
			window.location="/admin_music_info?mstatus=yes";
		}else{
			window.location="/admin_music_info?mstatus=no";
		}
		
	});
	
	});
	
	
$(function(){

	$("#select").click(function(){
	
		var mstatus=$("#status").val();
		var info=$("#selectvalue").val();
		if(mstatus=="all"){
			window.location="/admin_music_like?mstatus=all&info="+info+"";
		}else if(mstatus=="yes"){
			window.location="/admin_music_like?mstatus=yes&info="+info+"";
		}
		else {
			window.location="/admin_music_like?mstatus=no&info="+info+"";
		}
		
	});
	
})

function deletemusic(mid) {
		var music=$("#"+mid);
		$.ajax({
			type :"POST",
			url : "deletemusic",
			data : {"mid" :mid,},	
			success : function(message) {
				music.hide();
			}
		});
	}
	
var i=1;
function updatemAid(mAid,mid,obj) {
	var obj=$("#"+obj);
	$.ajax({
		type :"POST",
		url : "updatemAid",
		data : {"mAid":mAid,"mid" :mid},	
		success : function(message) {
			if(mAid==i){
				obj.html('<span style="color: red;">'+"未审核"+'</span>');
				i=0;
			}
			else{
				obj.html("已审核");
				i=1;
			}
			
		}
	});
}

</script>
</head>

<body>

	<div class="place">
		<span>位置：</span>
		<ul class="placeul">
			<li><a href="#">首页</a></li>
			<li><a href="#">征文信息</a></li>
		</ul>
	</div>

	<div class="formbody">


		<div id="usual1" class="usual">

			<div class="itab">
				<ul>
					<li><a href="#tab2" class="selected">歌曲信息管理</a></li>
				</ul>
			</div>

			<div id="tab2" class="tabson">


				<ul class="seachform">

					<li><label>综合查询</label><input name="" type="text"
						class="scinput" id="selectvalue" value="${info}" /></li>
					<li><label>&nbsp;</label><input name="" type="button"
						class="scbtn" id="select" value="查询" /></li>

					<li><label>歌曲状态</label>
						<div class="vocation">
							<select class="select3" id="selected1">
								<option id="chocked">-------</option>
								<option>全部</option>
								<option>已上架</option>
								<option>未上架</option>
							</select>
						</div></li>


				</ul>
				<input type="hidden" name="status" value="${mstatus}" id="status" />

				<table class="tablelist">
					<thead>
						<tr>
							<th><input name="" type="checkbox" value=""
								checked="checked" /></th>
							<th>编号<i class="sort"><img src="images/px.gif" /></i></th>
							<th>曲名</th>
							<th>作者</th>
							<th>发布时间</th>
							<th>是否审核</th>
							<th>操作</th>
						</tr>
					</thead>
					<tbody>
						<c:forEach items="${musiclist}" var="lis">
							<tr id="${lis.mid }">
								<td><input name="" type="checkbox" value="" /></td>
								<td>${lis.mid }</td>
								<td>${lis.mtitle}</td>
								<td>${lis.mname}</td>
								<td><fmt:formatDate value='${lis.mcreatetime }'
										pattern='yyyy-MM-dd HH:mm:ss' /></td>
								<td><c:if test="${lis.mAid==1 }">
										<a  onclick="updatemAid(${lis.mAid},${lis.mid},${lis.mid}${lis.mAid})"  href="javascript:void(0);"  id="${lis.mid}${lis.mAid}">已审核</a>
									</c:if> <c:if test="${lis.mAid==0 }">
										<a  onclick="updatemAid(${lis.mAid},${lis.mid},${lis.mid}${lis.mAid})"   href="javascript:void(0);"  id="${lis.mid}${lis.mAid}"><span
											style="color: red;">未审核</span></a>
									</c:if></td>
								<td>
									<a onclick="deletemusic(${lis.mid })"
									href="javascript:void(0);" class="tablelink"> 删除</a></td>
							</tr>
						</c:forEach>
					</tbody>
				</table>
				<div class="pagin">
					<div class="message">
						共<i class="blue">${page.total }</i>条记录，当前显示第&nbsp;<i class="blue">${page.pageNum }&nbsp;</i>页
					</div>
					<ul class="paginList">
						<li class="paginItem"><a
							href="/admin_music_info?pageNum=${page.pages}&mstatus=${mstatus}"><span
								class="pagepre"></span></a></li>
						<c:if test="${page.pageNum-3>=0 }">
							<li class="paginItem"><a
								href="/admin_music_info?mstatus=${mstatus }">1</a></li>
						</c:if>
						<c:if test="${page.pageNum-3>0 }">
							<li class="paginItem"><a href="javascript:;">...</a></li>
						</c:if>
						<c:if test="${page.pageNum-1>0 }">
							<li class="paginItem"><a
								href="/admin_music_info?pageNum=${page.pageNum-1 }&mstatus=${mstatus}">${page.pageNum-1 }</a></li>
						</c:if>
						<li class="paginItem current"><a href="javascript:;">${page.pageNum }</a></li>
						<c:if test="${page.pageNum+1<=page.pages }">
							<li class="paginItem"><a
								href="/admin_music_info?pageNum=${page.pageNum+1 }&mstatus=${mstatus}">${page.pageNum+1 }</a></li>
						</c:if>
						<c:if test="${page.pageNum+2<page.pages }">
							<li class="paginItem"><a href="javascript:;">...</a></li>
						</c:if>
						<c:if test="${page.pageNum+2<=page.pages }">
							<li class="paginItem"><a
								href="/admin_music_info?pageNum=${page.pages}&mstatus=${mstatus}">${page.pages }</a></li>
						</c:if>
						<li class="paginItem"><a
							href="/admin_music_info?pageNum=${page.pages}&mstatus=${mstatus}"><span
								class="pagenxt"></span></a></li>
					</ul>
				</div>



			</div>

		</div>

		<script type="text/javascript"> 
      $("#usual1 ul").idTabs(); 
    </script>

		<script type="text/javascript">
	$('.tablelist tbody tr:odd').addClass('odd');
	</script>





	</div>

</body>
</html>
